from time import sleep

from selenium.webdriver.common.by import By

from pages.base_page import Page


class MissedAndRefusedPage(Page):
    ele_missed_and_refused_title = (By.ID, u'page-missedAndRefusedChat-title')
    ele_missed_and_refused_date_filter = (By.CSS_SELECTOR, u".icon-filterDate")
    ele_missed_and_refused_last_month = (By.XPATH, u"//div[@role='tooltip']//li[last()]")

    def __init__(self, driver, url, site_id):
        Page.__init__(self, driver, url)
        self.site_id = site_id
        self.url = url

    def missed_and_refused_eles_check(self):
        self.find_element(*self.ele_missed_and_refused_title).is_enabled()
        self.find_element(*self.ele_missed_and_refused_date_filter).is_enabled()

    def missed_and_refused_search(self):
        self.click(self.ele_missed_and_refused_date_filter)
        self.click(self.ele_missed_and_refused_last_month)
